import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
} from '@nestjs/common';
import { TowerService } from './tower.service';
import { CreateTowerDto } from './dto/create-tower.dto';
import { UpdateTowerDto } from './dto/update-tower.dto';

@Controller('tower')
export class TowerController {
  constructor(private readonly towerService: TowerService) {}

  @Post('many')
  async createMany(@Body() createTowerDtoArr: CreateTowerDto[]) {
    return await this.towerService.createMany(createTowerDtoArr);
  }

  @Delete('many/:id')
  async deleteMany(@Param('id') id: string) {
    return await this.towerService.removeMany(+id);
  }

  @Get()
  async findAll(@Query() args = {}) {
    return await this.towerService.findAll(args);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.towerService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateTowerDto: UpdateTowerDto) {
    return this.towerService.update(+id, updateTowerDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.towerService.remove(+id);
  }
}
